package com.onlineshop.highgee.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.onlineshop.highgee.dao.ShopCarDao;
import com.onlineshop.highgee.daoimpl.ShopCarDaoImpl;
import com.onlineshop.highgee.entity.ShopCar;

/**
*椤圭洰鍚嶇О:HighGee
* 绫� 鍚� 绉�:ShowShopCarServlet
* 绫� 鎻� 杩�:
* 鍒� 寤� 浜�:souk
*鍒涘缓鏃堕棿:2019骞�12鏈�24鏃ヤ笂鍗�11:03:55
*@version
 */
@WebServlet("/ShowShopCarServlet")
public class ShowShopCarServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
   

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		try {
			ShopCarDao shopCarDao=new ShopCarDaoImpl();
			ShopCar shopcar=new ShopCar();					
				shopCarDao.addCar(shopcar);	
				double total=0;
				total=shopCarDao.total(total);	
				request.getSession().setAttribute("total", total);
				 System.out.println(total);
			//杞彂鍒癱art.jsp
			request.getRequestDispatcher("cart.jsp").forward(request, response);
		}catch(Exception e) {
			e.printStackTrace();
			
		}
			
		
		

		
	}
}
